/*
 * BetterUtility.h
 *
 *  Created on: 2011-3-22
 *      Author: 
 */

#ifndef BETTERUSERHBUFC_H_
#define BETTERUSERHBUFC_H_
#include <e32cmn.h>
class CElement;

class BetterUtility
{
public:
    static void Copy( HBufC*& dest, HBufC * text );
    static void Copy( HBufC*& dest, const TDesC & text );
    static void CreateAndCopy( HBufC*& dest, const TDesC & text );
    static void Append( HBufC*& dest, const TDesC & text );
    static HBufC* AllocNotNull( HBufC* sour );
    static HBufC* Alloc( HBufC* sour );
    static bool IsNullOrEmpty( const HBufC* text );

    static int CalcPercentValue( int percent, int total, int value );

    static HBufC* GetNotNullElementText( CElement* element );
    static HBufC* GetElementText( CElement* element );
    static int GetElementTextAsInt( CElement* elemnet );
    static float GetElementTextAsFloat( CElement* element );
    static bool CompareElementText( CElement* element, const TDesC& toCompare );
    static HBufC* EncodeL( const TDesC & des );
};

#endif /* BETTERUSERHBUFC_H_ */
